#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;

const int maxn = 1010;

int main() {
	int alpha_count[30] = {0};
	char str[maxn];
	cin.getline(str, maxn);
	int len = strlen(str);
	int max = 0;

	for (int i = 0; i < len; i++) {
		if (str[i] <= 'z' && str[i] >= 'a') {
			alpha_count[str[i] - 'a']++;	
		} else if (str[i] <= 'Z' && str[i] >= 'A') {
			alpha_count[str[i] - 'A']++;
		}
	}

	for (int i = 0; i < 26; i++) {
		if (alpha_count[max] < alpha_count[i]) {
			max = i;
		}
	}

	printf("%c %d\n", max+'a', alpha_count[max]);



	return 0;
}
